Source:Skills.h
Below is the full text to include/skills.h from NetHack 3.4.3. To link to a particular line, write [[skills.h#line123]], for example. 1. /* SCCS Id: @(#)skills.h 3.4 1999/10/27 */ 2. /* Copyright © Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. #ifndef SKILLS_H 6. #define SKILLS_H 7. 8. /* Much of this code was taken from you.h. It is now 9. * in a separate file so it can be included in objects.c. 10. */ 11. 12. 13. /* Code to denote that no skill is applicable */ 14. #define P_NONE 0 15. 16. /* Weapon Skills -- Stephen White 17. * Order matters and are used in macros. 18. * Positive values denote hand-to-hand weapons or launchers. 19. * Negative values denote ammunition or missiles. 20. * Update weapon.c if you ammend any skills. 21. * Also used for oc_subtyp. 22. */ 23. #define P_DAGGER 1 24. #define P_KNIFE 2 25. #define P_AXE 3 26. #define P_PICK_AXE 4 27. #define P_SHORT_SWORD 5 28. #define P_BROAD_SWORD 6 29. #define P_LONG_SWORD 7 30. #define P_TWO_HANDED_SWORD 8 31. #define P_SCIMITAR 9 32. #define P_SABER 10 33. #define P_CLUB 11 /* Heavy-shafted bludgeon */ 34. #define P_MACE 12 35. #define P_MORNING_STAR 13 /* Spiked bludgeon */ 36. #define P_FLAIL 14 /* Two pieces hinged or chained together */ 37. #define P_HAMMER 15 /* Heavy head on the end */ 38. #define P_QUARTERSTAFF 16 /* Long-shafted bludgeon */ 39. #define P_POLEARMS 17 40. #define P_SPEAR 18 41. #define P_JAVELIN 19 42. #define P_TRIDENT 20 43. #define P_LANCE 21 44. #define P_BOW 22 45. #define P_SLING 23 46. #define P_CROSSBOW 24 47. #define P_DART 25 48. #define P_SHURIKEN 26 49. #define P_BOOMERANG 27 50. #define P_WHIP 28 51. #define P_UNICORN_HORN 29 /* last weapon */ 52. #define P_FIRST_WEAPON P_DAGGER 53. #define P_LAST_WEAPON P_UNICORN_HORN 54. 55. /* Spell Skills added by Larry Stewart-Zerba */ 56. #define P_ATTACK_SPELL 30 57. #define P_HEALING_SPELL 31 58. #define P_DIVINATION_SPELL 32 59. #define P_ENCHANTMENT_SPELL 33 60. #define P_CLERIC_SPELL 34 61. #define P_ESCAPE_SPELL 35 62. #define P_MATTER_SPELL 36 63. #define P_FIRST_SPELL P_ATTACK_SPELL 64. #define P_LAST_SPELL P_MATTER_SPELL 65. 66. /* Other types of combat */ 67. #define P_BARE_HANDED_COMBAT 37 68. #define P_MARTIAL_ARTS P_BARE_HANDED_COMBAT /* Role distinguishes */ 69. #define P_TWO_WEAPON_COMBAT 38 /* Finally implemented */ 70. #ifdef STEED 71. #define P_RIDING 39 /* How well you control your steed */ 72. #define P_LAST_H_TO_H P_RIDING 73. #else 74. #define P_LAST_H_TO_H P_TWO_WEAPON_COMBAT 75. #endif 76. #define P_FIRST_H_TO_H P_BARE_HANDED_COMBAT 77. 78. #define P_NUM_SKILLS (P_LAST_H_TO_H+1) 79. 80. /* These roles qualify for a martial arts bonus */ 81. #define martial_bonus() (Role_if(PM_SAMURAI) || Role_if(PM_MONK)) 82. 83. 84. /* 85. * These are the standard weapon skill levels. It is important that 86. * the lowest "valid" skill be be 1. The code calculates the 87. * previous amount to practice by calling practice_needed_to_advance() 88. * with the current skill-1. To work out for the UNSKILLED case, 89. * a value of 0 needed. 90. */ 91. #define P_ISRESTRICTED 0 92. #define P_UNSKILLED 1 93. #define P_BASIC 2 94. #define P_SKILLED 3 95. #define P_EXPERT 4 96. #define P_MASTER 5 /* Unarmed combat/martial arts only */ 97. #define P_GRAND_MASTER 6 /* Unarmed combat/martial arts only */ 98. 99. #define practice_needed_to_advance(level) ((level)*(level)*20) 100. 101. /* The hero's skill in various weapons. */ 102. struct skills { 103. xchar skill; 104. xchar max_skill; 105. unsigned short advance; 106. }; 107. 108. #define P_SKILL(type) (u.weapon_skillstype.skill) 109. #define P_MAX_SKILL(type) (u.weapon_skillstype.max_skill) 110. #define P_ADVANCE(type) (u.weapon_skillstype.advance) 111. #define P_RESTRICTED(type) (u.weapon_skillstype.skill P_ISRESTRICTED) 112. 113. #define P_SKILL_LIMIT 60 /* Max number of skill advancements */ 114. 115. /* Initial skill matrix structure; used in u_init.c and weapon.c */ 116. struct def_skill { 117. xchar skill; 118. xchar skmax; 119. }; 120. 121. #endif /* SKILLS_H */ Category:source code